package com.pocket.insight.base.exception;

import com.pocket.insight.base.dto.ResponseCodeEnum;

/**
 * @author zhaozhile
 */
public abstract class BaseException extends RuntimeException {
    private static final long serialVersionUID = 1L;
    private Long errCode;
    private Object[] errArgs;

    public BaseException(String errMessage) {
        super(errMessage);
    }

    public BaseException(Long errCode, String errMessage) {
        super(errMessage);
        this.errCode = errCode;
    }

    public BaseException(String errMessage, Throwable e) {
        super(errMessage, e);
    }

    public BaseException(Long errCode, String errMessage, Throwable e) {
        super(errMessage, e);
        this.errCode = errCode;
    }

    public BaseException(Long errCode, Object... args) {
        super(ResponseCodeEnum.getMsg(errCode));
        this.errCode = errCode;
        this.errArgs = args;
    }

    public Long getErrCode() {
        return this.errCode;
    }

    public void setErrCode(Long errCode) {
        this.errCode = errCode;
    }
}
